Optimal. Leaf size=422 \[ -\frac {b \sqrt {a^2+b^2} \log \left (-\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \cot (c+d x)}+\sqrt {a^2+b^2}+a+b \cot (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}+\frac {b \sqrt {a^2+b^2} \log \left (\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \cot (c+d x)}+\sqrt {a^2+b^2}+a+b \cot (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}+\frac {b \sqrt {a^2+b^2} \tanh ^{-1}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}-\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}-\frac {b \sqrt {a^2+b^2} \tanh ^{-1}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}+\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.42, antiderivative size = 422, normalized size of antiderivative = 1.00, number of steps used = 13, number of rules used = 9, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3528, 12, 3485, 708, 1094, 634, 618, 206, 628} \[ -\frac {b \sqrt {a^2+b^2} \log \left (-\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \cot (c+d x)}+\sqrt {a^2+b^2}+a+b \cot (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}+\frac {b \sqrt {a^2+b^2} \log \left (\sqrt {2} \sqrt {\sqrt {a^2+b^2}+a} \sqrt {a+b \cot (c+d x)}+\sqrt {a^2+b^2}+a+b \cot (c+d x)\right )}{2 \sqrt {2} d \sqrt {\sqrt {a^2+b^2}+a}}+\frac {b \sqrt {a^2+b^2} \tanh ^{-1}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}-\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}-\frac {b \sqrt {a^2+b^2} \tanh ^{-1}\left (\frac {\sqrt {\sqrt {a^2+b^2}+a}+\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} d \sqrt {a-\sqrt {a^2+b^2}}}-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 206
Rule 618
Rule 628
Rule 634
Rule 708
Rule 1094
Rule 3485
Rule 3528
Rubi steps
\begin {align*} \int (-a+b \cot (c+d x)) \sqrt {a+b \cot (c+d x)} \, dx &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}+\int \frac {-a^2-b^2}{\sqrt {a+b \cot (c+d x)}} \, dx\\ &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}+\left (-a^2-b^2\right ) \int \frac {1}{\sqrt {a+b \cot (c+d x)}} \, dx\\ &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}+\frac {\left (b \left (a^2+b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {a+x} \left (b^2+x^2\right )} \, dx,x,b \cot (c+d x)\right )}{d}\\ &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}+\frac {\left (2 b \left (a^2+b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{a^2+b^2-2 a x^2+x^4} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{d}\\ &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}+\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}-x}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+x}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}\\ &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}+\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 d}+\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 d}-\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 x}{\sqrt {a^2+b^2}-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 x}{\sqrt {a^2+b^2}+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} x+x^2} \, dx,x,\sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}\\ &=-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}-\frac {b \sqrt {a^2+b^2} \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \sqrt {a^2+b^2} \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}-\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {1}{2 \left (a-\sqrt {a^2+b^2}\right )-x^2} \, dx,x,-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 \sqrt {a+b \cot (c+d x)}\right )}{d}-\frac {\left (b \sqrt {a^2+b^2}\right ) \operatorname {Subst}\left (\int \frac {1}{2 \left (a-\sqrt {a^2+b^2}\right )-x^2} \, dx,x,\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}}+2 \sqrt {a+b \cot (c+d x)}\right )}{d}\\ &=\frac {b \sqrt {a^2+b^2} \tanh ^{-1}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}-\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {b \sqrt {a^2+b^2} \tanh ^{-1}\left (\frac {\sqrt {a+\sqrt {a^2+b^2}}+\sqrt {2} \sqrt {a+b \cot (c+d x)}}{\sqrt {a-\sqrt {a^2+b^2}}}\right )}{\sqrt {2} \sqrt {a-\sqrt {a^2+b^2}} d}-\frac {2 b \sqrt {a+b \cot (c+d x)}}{d}-\frac {b \sqrt {a^2+b^2} \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)-\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}+\frac {b \sqrt {a^2+b^2} \log \left (a+\sqrt {a^2+b^2}+b \cot (c+d x)+\sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} \sqrt {a+b \cot (c+d x)}\right )}{2 \sqrt {2} \sqrt {a+\sqrt {a^2+b^2}} d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 1.06, size = 158, normalized size = 0.37 \[ \frac {\sin (c+d x) (b \cot (c+d x)-a) \left (\frac {i \left (a^2+b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a-i b}}\right )}{\sqrt {a-i b}}-\frac {i \left (a^2+b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a+b \cot (c+d x)}}{\sqrt {a+i b}}\right )}{\sqrt {a+i b}}+2 b \sqrt {a+b \cot (c+d x)}\right )}{d (a \sin (c+d x)-b \cos (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \sqrt {b \cot \left (d x + c\right ) + a} {\left (b \cot \left (d x + c\right ) - a\right )}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.54, size = 2285, normalized size = 5.41 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \sqrt {b \cot \left (d x + c\right ) + a} {\left (b \cot \left (d x + c\right ) - a\right )}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 2.57, size = 583, normalized size = 1.38 \[ -\mathrm {atanh}\left (\frac {d^3\,\left (\frac {16\,\left (a^2\,b^4-a^4\,b^2\right )\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{d^2}+\frac {16\,a\,b^2\,\left (a^3+1{}\mathrm {i}\,b\,a^2\right )\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{d^2}\right )\,\sqrt {-\frac {a^3+1{}\mathrm {i}\,b\,a^2}{d^2}}}{16\,\left (a^5\,b^3+a^3\,b^5\right )}\right )\,\sqrt {-\frac {a^3+1{}\mathrm {i}\,b\,a^2}{d^2}}-\mathrm {atanh}\left (\frac {d^3\,\sqrt {\frac {-a^3+a^2\,b\,1{}\mathrm {i}}{d^2}}\,\left (\frac {16\,\left (a^2\,b^4-a^4\,b^2\right )\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{d^2}-\frac {16\,a\,b^2\,\left (-a^3+a^2\,b\,1{}\mathrm {i}\right )\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{d^2}\right )}{16\,\left (a^5\,b^3+a^3\,b^5\right )}\right )\,\sqrt {\frac {-a^3+a^2\,b\,1{}\mathrm {i}}{d^2}}-\frac {2\,b\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{d}+\mathrm {atan}\left (\frac {b^6\,\sqrt {\frac {a\,b^2}{4\,d^2}-\frac {b^3\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}\,32{}\mathrm {i}}{\frac {b^8\,16{}\mathrm {i}}{d}+\frac {a^2\,b^6\,16{}\mathrm {i}}{d}}+\frac {32\,a\,b^5\,\sqrt {\frac {a\,b^2}{4\,d^2}-\frac {b^3\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{\frac {b^8\,16{}\mathrm {i}}{d}+\frac {a^2\,b^6\,16{}\mathrm {i}}{d}}\right )\,\sqrt {\frac {a\,b^2-b^3\,1{}\mathrm {i}}{4\,d^2}}\,2{}\mathrm {i}-\mathrm {atan}\left (\frac {b^6\,\sqrt {\frac {a\,b^2}{4\,d^2}+\frac {b^3\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}\,32{}\mathrm {i}}{\frac {b^8\,16{}\mathrm {i}}{d}+\frac {a^2\,b^6\,16{}\mathrm {i}}{d}}-\frac {32\,a\,b^5\,\sqrt {\frac {a\,b^2}{4\,d^2}+\frac {b^3\,1{}\mathrm {i}}{4\,d^2}}\,\sqrt {a+b\,\mathrm {cot}\left (c+d\,x\right )}}{\frac {b^8\,16{}\mathrm {i}}{d}+\frac {a^2\,b^6\,16{}\mathrm {i}}{d}}\right )\,\sqrt {\frac {b^3\,1{}\mathrm {i}+a\,b^2}{4\,d^2}}\,2{}\mathrm {i} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ - \int a \sqrt {a + b \cot {\left (c + d x \right )}}\, dx - \int \left (- b \sqrt {a + b \cot {\left (c + d x \right )}} \cot {\left (c + d x \right )}\right )\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________